<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
    <title>字典表详情页</title>
    <link href="../../layui/css/layui.css" rel="stylesheet">
    <!-- 样式 -->
    <link href="../../css/style.css" rel="stylesheet"/>
    <!-- 主题（主要颜色设置） -->
    <link href="../../css/theme.css" rel="stylesheet"/>
    <!-- 通用的css -->
    <link href="../../css/common.css" rel="stylesheet"/>
    <link href="../../xznstatic/css/bootstrap.min.css" rel="stylesheet">
</head>
<style>
</style>
<body>

<div id="app">
</div>


<script src="../../layui/layui.js"></script>
<script src="../../js/vue.js"></script>
<!-- 引入element组件库 -->
<script src="../../xznstatic/js/element.min.js"></script>
<!-- 引入element样式 -->
<link href="../../xznstatic/css/element.min.css" rel="stylesheet">
<!-- 组件配置信息 -->
<script src="../../js/config.js"></script>
<!-- 扩展插件配置信息 -->
<script src="../../modules/config.js"></script>
<!-- 工具方法 -->
<script src="../../js/utils.js"></script>

<script>
    Vue.prototype.myFilters = function (msg) {
        if (msg != null) {
            return msg.replace(/\n/g, "<br>");
        } else {
            return "";
        }
    };
    var vue = new Vue({
        el: '#app',
        data: {
            //当前登录用户信息
            user: {},
            // 轮播图
            swiperList: [],//用于当前表的图片
            // 数据详情
            detail: {
                id: 0
            },
            // 商品标题
            title: '',
            totalScore: 0,//评分
            baseUrl: "",//路径
            storeupFlag: 0,//收藏 [0为收藏 1已收藏]
            //系统推荐
            dictionaryRecommendList: [],
            // 当前详情页表
            detailTable: 'dictionary',
        },
        methods: {
            //分享
            share() {
                let element = createElement("http://localhost:8080/mhwangshangdingpiao/front/index.html?url=" + "./pages/dictionary/detail.html?id=" + this.id);
                element.select();
                element.setSelectionRange(0, element.value.length);
                document.execCommand('copy');
                element.remove();
                layui.layer.msg('复制分享页面成功,快去分享吧!', {time: 2000, icon: 6});
            },

            jump(url) {
                jump(url)
            },
            isAuth(tablename, button) {
                return isFrontAuth(tablename, button)
            },
            //预约
            dictionaryYuyue() {
                let _this = this;
                var mymessage = confirm("确定要预约吗？");
                if (!mymessage) {
                    return false;
                }
                // localStorage.setItem('dictionaryId', _this.detail.id);
                // _this.jump("../dictionaryOrder/add.html");

                let data = {
                    dictionaryId: _this.detail.id,
                    yonghuId: localStorage.getItem("userid"),
                    dictionaryOrderYesnoTypes: 1,
                }
                // 提交数据
                layui.http.requestJson('dictionaryOrder/add', 'post', data, function (res) {
                    if (res.code == 0) {
                        layui.layer.msg('预约成功', {
                            time: 2000,
                            icon: 6
                        }, function () {
                            _this.jump("../dictionaryOrder/list.html");
                        });
                    } else {
                        layui.layer.msg(res.msg, {
                            time: 5000,
                            icon: 5
                        });
                    }
                });
            },

        }
    });

    layui.use(['layer', 'form', 'element', 'carousel', 'http', 'jquery', 'laypage', 'util'], function () {
        var layer = layui.layer;
        var util = layui.util;
        var element = layui.element;
        var form = layui.form;
        var carousel = layui.carousel;
        var http = layui.http;
        var jquery = layui.jquery;
        var laypage = layui.laypage;
        vue.baseUrl = http.baseurl

        localStorage.setItem("goUtl", "./pages/dictionary/detail.html?id=" + http.getParam('id'))

        var limit = 10;

        let table = localStorage.getItem("userTable");
        if (table) {
            http.request(table + "/session", 'get', {}, function (data) {
                vue.user = data.data;
            });
        }

        // 数据ID
        var id = http.getParam('id');
        vue.detail.id = id;
    });
</script>
</body>
</html>
